<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script type="module">
    import Promisee from './index.js';
    // const p = new Promisee(function (resolve,reject){
    //     setTimeout(()=>{
    //         reject(100);
    //     },200)
    // })
    //
    // console.log(p);
    const p1 = new Promisee(function (resolve,reject){
        setTimeout(()=>{
            reject(1);
        },100)
    })
    const p2 = new Promisee(function (resolve,reject){
        setTimeout(()=>{
            reject(2);
        },10)
    })
    const p3 = new Promisee(function (resolve,reject){
        setTimeout(()=>{
            resolve(3);
        },300)
    })
    const p4 = new Promisee(function (resolve,reject){
        setTimeout(()=>{
            resolve(4);
        },600)
    })

    // console.log(Promisee.all([p1, p2, p3, p4]));
    console.log(Promisee.race([p1, p2, p3, p4]));


    //异常穿透 : 当链式操作中上一个promise实例对象为失败状态 ,
    //且下一个then没有设置失败回调函数 , 则会发生异常穿透
    //重点在于对then中成功回调和失败回调的默认值的理解
</script>
</body>
</html>